//
//  macro.h
//  CBT
//
//  Created by 四点钟 on 2018/11/15.
//  Copyright © 2018 Mr.Zhang. All rights reserved.
//

/**
 *-----常用宏-------*
 **/
#ifndef weak
#if DEBUG
#if __has_feature(objc_arc)
#define weak(object) autoreleasepool{} __weak __typeof__(object) object##_##weak_ = object;
#else
#define weak(object) autoreleasepool{} __block __typeof__(object) object##_##block_ = object;
#endif
#else
#if __has_feature(objc_arc)
#define weak(object) try{} @finally{} {} __weak __typeof__(object) object##_##weak_ = object;
#else
#define weak(object) try{} @finally{} {} __block __typeof__(object) object##_##block_ = object;
#endif
#endif
#endif

#ifndef strong
#if DEBUG
#if __has_feature(objc_arc)
#define strong(object) autoreleasepool{} __typeof__(object) object = object##_##strong_;
#else
#define strong(object) autoreleasepool{} __typeof__(object) object = object##_##block_;
#endif
#else
#if __has_feature(objc_arc)
#define strong(object) try{} @finally{} __typeof__(object) object = object##_##strong_;
#else
#define strong(object) try{} @finally{} __typeof__(object) object = object##_##block_;
#endif
#endif
#endif

#ifndef dispatch_safe_main
#define dispatch_safe_main(block) if ([NSThread isMainThread]) {block();}else{dispatch_async(dispatch_get_main_queue(),block);}
#endif

#ifndef dispatch_sub_thread
#define dispatch_sub_thread(block) if ([NSThread isMainThread]) {dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0),block);}else{block();}
#endif


#define ValidString(str) ([str isKindOfClass:[NSString class]]&&str.length>0&&![str containsString:@"(null)"])

#define HFDefaults(aaa) [[NSUserDefaults standardUserDefaults] objectForKey:aaa]
#define HEFANTV_TimeTamp_Gap @"TimeTampGap"

#define HFTimer @( [[NSString stringWithFormat:@"%f",([[NSDate dateWithTimeIntervalSinceNow:0] timeIntervalSince1970]*1000)] longLongValue])

//点击底部按钮,页面进行刷新
#define Noticy_RefrshData_TabBarClick @"Noticy_RefrshData_TabBarClick"

